package com.galeno.json;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

/**
 * @author galeno
 * @Title:
 * @Description:
 * @date 2021/7/2522:50
 */
public class MovieBean implements Writable {
    private int movie;
    private double rate;
    private String timeStamp;
    private int uid;

    public int getMovie() {
        return movie;
    }

    public void setMovie(int movie) {
        this.movie = movie;
    }

    public double getRate() {
        return rate;
    }

    public void setRate(double rate) {
        this.rate = rate;
    }

    public String getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(String timeStamp) {
        this.timeStamp = timeStamp;
    }

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    @Override
    public String toString() {
        return "MovieBean{" +
                "movie=" + movie +
                ", rate=" + rate +
                ", timeStample='" + timeStamp + '\'' +
                ", uid=" + uid +
                '}';
    }

    public void set(int movie, double rate, String timeStamp, int uid) {
        this.movie = movie;
        this.rate = rate;
        this.timeStamp = timeStamp;
        this.uid = uid;
    }

    public MovieBean() {

    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeInt(movie);
        dataOutput.writeDouble(rate);
        dataOutput.writeUTF(timeStamp);
        dataOutput.writeInt(uid);


    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        movie = dataInput.readInt();
        rate = dataInput.readDouble();
        timeStamp = dataInput.readUTF();
        uid = dataInput.readInt();


    }
}
